<?php
namespace app\web\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class Goods extends Validate
{
    //定义验证规则
    protected $rule = [
        'name'  => 'require',
        'price'  => 'require',
//        'img'  => 'require',
        'goods_category_id'=>'require',
        'engineer_rate'  => 'require|number',
        'receiver_rate'  => 'require|number',
        'description'  => 'require',
        'is_change_price'  => 'require',
        'is_viper_pay'  => 'require',
        'is_sale'  => 'require',
        'goods_id'  => 'require',
        'product_id'  => 'require',
        'number'  => 'require',
    ];
    //定义验证提示
    protected $message = [
        'name.require' => '请输入商品名称',
        'price.require' => '请输入商品价格',
//        'img.require' => '请上传商品图',
        'goods_category_id.require' => '请选择商品分类',
        'engineer_rate.require' => '请填写技师提成',
        'engineer_rate.number' => '技师提成为整数',
        'receiver_rate.require' => '请填写接待提成',
        'receiver_rate.number' => '请填写接待提成',
        'is_change_price.require' => '请选择是否修改价格',
        'is_viper_pay.number' => '请选择是否会员支付',
        'is_sale.require' => '请选择是否在售',
        'description.require' => '请填写商品描述',
        'goods_id.require' => '请选择商品',
        'product_data.require' => '请选择库存商品',
    ];
    //定义验证场景
    protected $scene = [
        'goods_product'   =>  ['goods_id','product_data'],
    ];

}
